package main

import (
	grpc2 "google.golang.org/grpc"
	"yk-travel-social/common/consul"
	"yk-travel-social/common/cron"
	"yk-travel-social/common/grpc"
	"yk-travel-social/common/model/es"
	"yk-travel-social/common/model/mysql"
	"yk-travel-social/common/model/redis"
	"yk-travel-social/common/nacos"
	"yk-travel-social/common/viper"
	"yk-travel-social/service/internal"
)

func main() {
	viper.ConfigInit()
	nacos.InitNaCos()
	consul.InitConsulService()
	mysql.MysqlInit()
	redis.RedisInit()
	es.EsInit()

	go func() {
		cron.SyncEs()
	}()

	nac := nacos.Config.Group
	grpc.RegisterGrpc(nac.Host, nac.Port, func(s *grpc2.Server) {
		internal.Register(s)
	})
}
